import { http } from '@/utils/http';
import type { Plan } from './index.d';

export { Plan };

/**  获取计划 -- 年级 */
export const getPlanGradeList = () => {
	return http<Plan.GradeData[]>({
		url: `/api/grade`,
		method: 'GET',
	});
};

/**  获取计划列表 */
export const getPlanList = (query: Plan.ListParams) => {
	return http<Plan.ListData[]>({
		url: `/api/plan/list`,
		method: 'GET',
		query,
	});
};

/**  获取用户班级计划列表 */
export const getPlanClassList = (query: Plan.ClassParams) => {
	return http<Plan.ClassData>({
		url: `/api/plan/class`,
		method: 'GET',
		query,
	});
};

/**  获取计划详情 */
export const getPlanDetails = (query: Plan.DetailsParams) => {
	return http<Plan.DetailsData>({
		url: `/api/plan/${query.id}`,
		method: 'GET',
	});
};

/**  获取学生排行接口【平台/班级计划】 */
export const getPlanParticiRecord = (query: Plan.ParticiParams) => {
	return http<Plan.ParticiData>({
		url: `/api/plan/student_top/${query.id}`,
		method: 'GET',
		query,
	});
};

/**  获取班级排行接口【平台/班级计划】 */
export const getPlanClassRecord = (query: Plan.ClassRecordParams) => {
	return http<Plan.ClassRecordData>({
		url: `/api/plan/class_top/${query.id}`,
		method: 'GET',
		query,
	});
};
